﻿CREATE VIEW dbo.BoatData_View
AS
SELECT     BoatGenID, SOURCE, BoatMnfID, Manufacturer, BoatRange, BoatModel, BoatType, BoatTypeID, Draft, BoatLoaGrpID, Loa, FirstHullNo, LastHullNo, DesignYear, 
                      BoatName, [SAIL NUMBER], BoatRigGrpID, Smart, Expr1, Cb, CERTIFICATE, CountryID, Beam, Displ, Dl, Dwsd, [Mast No], MastID, BoomID, BAS, FL, I, J, P, E, Py, Ey, 
                      Ios, Jos, Isp, Iss, Jss, Iys, Jys, Igs, Jgs, POLE_SPRIT, Spl, Stl, FURLER, [Fwd_Aft Lower], [Half width at D1 anchorage], [Half width at V1 anchorage], HasImage, 
                      Headstay1ID, Headstay1ID2, Headstay1ID3, HHB, HHW, HSA, HTW, LP, LL, LLM, LLY, LPY, MHW, MTW, MUW, ASF, ASHW, ASLE, ASLU, SL, SF, SHW, SMW, SPA, 
                      [Import ID], [Keel Stepped  _Yes_N0], [SP1 Ht], [Length SP1], [Lift SP1], SP2, [Length SP2], [Lift SP2], [SP3 Ht], [Length SP3], [Lift SP3], Expr2, Chainplates_partner, 
                      CHECKSTAYS, [Inter stay], SPREADERS, JUMPERS, RUNNERS, [Lower runner], [Main Area], LWL, Mast_deck_Waterline, BowRake, BowShear, [Angle Chainplates], 
                      [Cable type], [Ø Backstay], [Ø D1], [Ø D1 Avt], [Ø D2], [Ø D3], [Ø Double backstay], [Ø Head stay], [Ø intermediate], [Ø Lower shroud], [Ø Lower stay], [Ø Top shroud], 
                      [Ø V1], [Ø V2], [Ø V2D3], [Ø V3D4], [Ø Y  backstay], [Pied arrière _au pont_ du pataras ou bastaque principale], Private, Prop, Rating, Rigging, RigType, [Gz max _m_], 
                      [Rm max _kg#m_ Designer], [Rm max  _kg#m_], [RM Test configuration], SailPlan, TranShear, Upsd, Measured, MeasurementForm, Notes, LEFT(LastUpdated, 10) 
                      AS lastupdated,
                          (SELECT     BoatType
                            FROM          dbo.BoatType_Tbl
                            WHERE      (BoatTypeID = dbo.GenBoatData_Tbl.BoatTypeID)) AS RM,
                          (SELECT     BoatRigGrp
                            FROM          dbo.BoatRigGrp_Tbl
                            WHERE      (BoatRigGrpID = dbo.GenBoatData_Tbl.BoatRigGrpID)) AS BoatRigGrp,
                          (SELECT     CASE WHEN genboatdata_Tbl.measured IS NULL THEN 0 ELSE genboatdata_Tbl.measured END AS Expr1) AS MM
FROM         dbo.GenBoatData_Tbl